﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SportsPlatform.Base;
using SportsPlatform.Dto.PermissionManagement.CompanyInfo;
using SportsPlatform.Dto.SportBusiness.CompetitionAchievementInfo;
using SportsPlatform.Dto.SportBusiness.GetPaymentOrderInfo;
using SportsPlatform.Dto.SportBusiness.PaymentOrderOperationInfo;
using SportsPlatform.Filters;
using SportsPlatform.Query.Competition;
using SportsPlatform.Query.SportBusiness.GetPaymentOrderInfo;
using SportsPlatform.Query.SportBusiness.PaymentOrderInfo;
using SportsPlatform.Query.SportBusiness.RegistrationInfo;
using SportsPlatform.SportBusiness.ISportBusiness;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SportsPlatform.Controllers
{
    /// <summary>
    /// 订单管理控制器
    /// </summary>

    [ActionAuthorization]
    [Route("api/[controller]/[action]")]
    public class PaymentOrderInfoController : SportsPlatformControllerBase
    {
        private IPaymentOrderInfoService _paymentOrderInfoService;
        public PaymentOrderInfoController(IPaymentOrderInfoService paymentOrderInfoService)
        {
            _paymentOrderInfoService = paymentOrderInfoService;
        }

        /// <summary>
        /// 订单列表
        /// </summary>
        /// <param name="query">传入参数 </param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PagePagingDto<PaymentOrderInfoListDto>> GetPaymentOrderInfoList([FromBody] GetPaymentOrderInfoQuery query)
        {
            return await _paymentOrderInfoService.GetPaymentOrderInfoList(query);
        }

        /// <summary>
        /// 获取赛事列表
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<ResultListDto<GetCompetitionSelectItemQuery>> GetCompetitionsList()
        {
            return await _paymentOrderInfoService.GetAll();
        }

        /// <summary>
        /// 获取赛事商户列表
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<ResultListDto<GetCompanysSelectItemListQuery>> GetCompanysList()
        {
            return await _paymentOrderInfoService.GetCompanysList();
        }

        /// <summary>
        /// 添加订单信息
        /// </summary>
        /// <param name="infoQuery">传入参数</param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultByIdDto> AddPaymentOrderInfo([FromBody] AddPaymentOrderInfoQuery infoQuery)
        {
            return await _paymentOrderInfoService.AddInfo(infoQuery);
        }

        /// <summary>
        /// 更新订单信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> UpdatePaymentOrderInfo([FromBody] UpdatePaymentOrderInfoQuery query)
        {
            return await _paymentOrderInfoService.UpdatePaymentOrderInfo(query);
        }

        /// <summary>
        /// 获取订单信息特定属性接口
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultDto<GetPaymentOderInfoDto>> GetByPaymentOrderInfoDetailsId([FromBody] GetInfoQuery query)
        {
            return await _paymentOrderInfoService.GetByPaymentOrderInfoDetailsId(query);
        }

        /// <summary>
        /// 获取订单信息标题属性接口
        /// </summary>
        /// <param name="query">传入参数</param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultDto<GetPaymentOderInfoTitleDto>> GetPaymentOderInfoTitleById([FromBody] GetInfoQuery query)
        {
            return await _paymentOrderInfoService.GetPaymentOderInfoTitleById(query);
        }

        /// <summary>
        /// 添加订单详情备注
        /// </summary>
        /// <param name="query">传入参数</param>
        /// <returns></returns>
        [HttpPost]
        public async Task<BaseResultDto> AddOrderNotes([FromBody] AddOrderNotesQuery query)
        {
            return await _paymentOrderInfoService.AddOrderNotes(query);
        }

        /// <summary>
        /// 获取费用信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultDto<GetPriceInfoQuery>> GetPriceInfo([FromBody] GetInfoQuery query)
        {
            return await _paymentOrderInfoService.GetPriceInfo(query);
        }

        /// <summary>
        /// 获取提交用户信息
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultDto<GetCommitEmployeeQuery>> GetCommitEmployee([FromBody] GetInfoQuery query)
        {
            return await _paymentOrderInfoService.GetCommitEmployee(query);
        }

        /// <summary>
        /// 获取报名信息
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultListDto<GetRegistrationInfoQuery>> GetRegistrationInfo([FromBody] GetInfoQuery query)
        {
            return await _paymentOrderInfoService.GetRegistrationInfo(query);
        }

        /// <summary>
        /// 导出操作记录列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultDto<DownloadEventsSessionCompetitionAchievementDto>> ExportActionInfo([FromBody] GetActionInfoQuery query)
        {
            return await _paymentOrderInfoService.ExportActionInfo(query);
        }

        /// <summary>
        /// 获取操作记录列表
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ResultListDto<PaymentOrderOperationInfoListDto>> GetOrderInfoList([FromBody] GetInfoQuery query)
        {
            return await _paymentOrderInfoService.GetOrderInfoList(query);
        }
    }
}
